package com.chris.controller;

import com.chris.security.utils.LoginUtils;
import com.chris.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by chris on 2019/2/2.
 */
@RestController
public class TestController {

    @Autowired
    private UserService userService;


    @GetMapping("hello")
    public String hello() {
        System.out.println(LoginUtils.getLoginUserId());
        return "hello";
    }

    // jpa
    /*@GetMapping("person")
    public String person() {
        Optional<Person> byId = personService.findById(1L);
        System.out.println(byId.isPresent());
        Person person = byId.get();
        return personService.findById(1L).toString();
    }

    @GetMapping("person2")
    public String person2() {
        Person personById = personService.findPersonById(1L);
        return personById.toString();
    }*/

    // mybatis
//    @GetMapping("person")
//    public Map person() {
//        User byId = userService.findById(1L);
//        return byId;
//    }


}
